<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box"></div>
    <script src="./js/axios.js"></script>
    <script>
        //axios  并发
        function getData1() {
            return axios.get('./json/01.json');
        }

        function getData2() {
            return axios.get('./json/02.json');
        }
        function getData3() {
            return axios.get('./json/03.json');
        }

        // axios.all([getData1(), getData2(), getData3()]).then(res => {
        //     console.log(res);
        //     //重组数据

        // })

        //axios.spread 相当于将返回的数组结果解构了
        axios.all([getData1(), getData2(), getData3()]).then(axios.spread(function (a1, a2, a3) {
            console.log(a1, a2, a3);
        }))

    </script>
</body>

</html>